package cn.community.care.module.system.dal.mysql.project;

import java.util.*;

import cn.community.care.framework.common.pojo.PageResult;
import cn.community.care.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.community.care.framework.mybatis.core.mapper.BaseMapperX;
import cn.community.care.module.system.controller.admin.project.vo.ProjectPageReqVO;
import cn.community.care.module.system.dal.dataobject.project.ProjectDO;
import org.apache.ibatis.annotations.Mapper;
/**
 * 养老服务项目 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface ProjectMapper extends BaseMapperX<ProjectDO> {

    default PageResult<ProjectDO> selectPage(ProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProjectDO>()
                .likeIfPresent(ProjectDO::getProjectName, reqVO.getProjectName())
                .eqIfPresent(ProjectDO::getDescription, reqVO.getDescription())
                .eqIfPresent(ProjectDO::getPrice, reqVO.getPrice())
                .eqIfPresent(ProjectDO::getDurationMinutes, reqVO.getDurationMinutes())
                .eqIfPresent(ProjectDO::getServiceType, reqVO.getServiceType())
                .eqIfPresent(ProjectDO::getStaffRequirements, reqVO.getStaffRequirements())
                .eqIfPresent(ProjectDO::getSuitableFor, reqVO.getSuitableFor())
                .eqIfPresent(ProjectDO::getLocation, reqVO.getLocation())
                .eqIfPresent(ProjectDO::getIsOptional, reqVO.getIsOptional())
                .orderByDesc(ProjectDO::getId));
    }

}